package org.microframework.base.core.datasource;

import org.microframework.base.core.datasource.seata.SeataConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * micro-base-datasource模块自动配置类
 * 用于整合JFinal和Seata的配置
 * 
 * <p>此配置类可以通过以下两种方式启用：</p>
 * <ol>
 *   <li>自动配置：添加依赖后自动生效（可通过配置禁用）</li>
 *   <li>注解方式：使用 @EnableMicroDataSource 注解显式启用</li>
 * </ol>
 */
@AutoConfiguration
@Configuration
@ConditionalOnProperty(prefix = "micro.datasource", name = "enabled", havingValue = "true", matchIfMissing = true)
@ComponentScan(basePackages = {
    "org.microframework.base.core.datasource",
    "org.microframework.base.core.datasource.aop",
    "org.microframework.base.core.datasource.seata"
})
@Import({
    ActiveRecordConfiguration.class,
    SeataConfiguration.class
})
public class MicroDataSourceAutoConfiguration {
    // 自动配置逻辑主要通过@Import和@ComponentScan实现
} 